package com.sokal.easycare.modules.payment.entity;

import java.util.Date;

import org.hibernate.validator.constraints.Length;

import com.sokal.easycare.common.persistence.DataEntity;
import com.sokal.easycare.common.utils.StringUtils;
import com.sokal.easycare.modules.sys.entity.UserBankAccount;

/**
 * 保存交易记录Entity
 * 
 * @author nibo
 * @version 2017-04-10
 */
public class TransactionRecord extends DataEntity<TransactionRecord> {

	private static final long serialVersionUID = 1L;
	private Double fee; // 金额
	private String type; // 类型:1,充值2.支付,3提现,4冻结,5解冻,6提现,7转账,8垫付,9垫付返回,10保证金,11质保金
	private String desUserId; // 收账人
	private String srcUserId; // 出账人
	private String status; // 1,待处理,2 完成
	private String source; // ali,weixin,user,bank
	private String comments; // comments
	private Date createDate; // comments
	private UserBankAccount bankAccount; // 银行卡ID

	public TransactionRecord() {
		super();
		this.status = "0";
	}

	public TransactionRecord(String id) {
		super(id);
		this.status = "0";
	}

	public TransactionRecord(String desUserId, String srcUserId) {
		super();
		this.status = "0";
		this.desUserId = desUserId;
		this.srcUserId = srcUserId;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public Double getFee() {
		return fee;
	}

	public void setFee(Double fee) {
		this.fee = fee;
	}

	@Length(min = 0, max = 50, message = "支付,3提现,4冻结,5解冻长度必须介于 0 和 3 之间")
	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getSource() {
		return source;
	}

	public void setSource(String source) {
		this.source = source;
	}

	@Length(min = 0, max = 50, message = "收账人长度必须介于 0 和 50 之间")
	public String getDesUserId() {
		return desUserId;
	}

	public void setDesUserId(String desUserId) {
		this.desUserId = desUserId;
	}

	@Length(min = 0, max = 50, message = "出账人长度必须介于 0 和 50 之间")
	public String getSrcUserId() {
		return srcUserId;
	}

	public void setSrcUserId(String srcUserId) {
		this.srcUserId = srcUserId;
	}

	@Length(min = 0, max = 255, message = "comments长度必须介于 0 和 255 之间")
	public String getComments() {
		return comments;
	}

	public void setComments(String comments) {
		this.comments = comments;
	}

	public String getStatusDes() {
		if (StringUtils.isNotBlank(status)) {
			if ("1".equals(status)) {
				return "待处理";
			} else if ("2".equals(status)) {
				return "已处理";
			}
		}
		return "";
	}

	public UserBankAccount getBankAccount() {
		return bankAccount;
	}

	public void setBankAccount(UserBankAccount bankAccount) {
		this.bankAccount = bankAccount;
	}

}